{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">快讯列表</li>
            <li><a href="{:url('admin/newsflash/add')}">添加快讯</a></li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

                <form class="layui-form layui-form-pane" action="{:url('admin/newsflash/newsFlashlList')}" method="get">
                    <div class="layui-inline">
                        <label class="layui-form-label">关键字</label>
                        <div class="layui-input-inline">
                            <input type="text" name="keyword" value="{$keyword}" placeholder="请输入关键字" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">快讯分类</label>
                        <div class="layui-input-inline">
                            <select name="knowledge_class"  lay-search="">
                                {if empty($knowledge_class)}   <option value="">请选择</option> {/if}
                                {foreach	$column	as	$key=>$value}
                                <option value="{$value.id}" {if $knowledge_class==$value.id } selected {/if}>{$value.knowledge_class_name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">显示条数</label>
                        <div class="layui-input-inline">
                            <input type="text" name="limit" value="{$limit}" placeholder="请输入关键词" class="layui-input">
                        </div>
                    </div>


                    <div class="layui-inline">
                        <label class="layui-form-label">时间排序</label>
                        <div class="layui-input-inline">
                            <select name="sort"  lay-search="">
                                {if $sort=='desc' }
                                <option value="desc" selected> 按时间倒序</option>
                                <option value="asc" > 按时间正序</option>
                                {else/}
                                <option value="desc"> 按时间倒序</option>
                                <option value="asc" selected>按时间正序</option>
                                {/if}>

                            </select>
                        </div>
                    </div>


                    <div class="layui-inline" style="float: right">
                        <button class="layui-btn">搜索</button>
                    </div>
                </form>
                <hr>
                <form action="" method="post" class="ajax-form">

                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="width: 15px;"><input type="checkbox" class="check-all"></th>
                        <th style="width: 30px;">ID</th>
                        <th>排序</th>
                        <th>快讯标题</th>
                        <th>快讯来源</th>
                        <th>发布作者</th>
                        <th>快讯分类</th>
                        <th>快讯标签</th>
                        <th>状态</th>
                        <th>发布时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody class="content-box">
                    {volist name="NewsFlash" id="vo"}
                    <tr>
                        <td><input type="checkbox" name="ids[]" value="{$vo.id}"></td>
                        <td>{$vo.id}</td>
                        <td>       <input style="margin: 0 auto; width: 60px" type="text" name="sort" value="{$vo.sort}" altid="{$vo.id}" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input content-sort-num"></td>
                        <th>{$vo.name}</th>
                        <th>{$vo.source}</th>
                        <th>{$vo.author}</th>
                        <th>{$vo.index_column_name}</th>
                        <th>
                            {foreach	$vo['label_name']	as	$value}
                            {$value }
                            {/foreach}
                        </th>
                        <td class="layui-form">

                            <input type="checkbox" name="online_type" value="{$vo.id}" lay-skin="switch"
                                   lay-text="ON|OFF" lay-filter="changeStatus"
                                   {if $vo.status == 1}
                                   checked
                                   {/if}
                            >
                        </td>
                        <th>{$vo.publish_time}</th>
                        <td>
                            <a href="{:url('admin/newsflash/com_list', ['id' => $vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">评论</a>
                            <a href="{:url('admin/newsflash/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                            <a href="{:url('admin/newsflash/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                    <!--:url('blog/read', 'name=thinkphp')-->
                    <button type="button" class="layui-btn layui-btn-danger layui-btn-small ajax-action" data-action="{:url('admin/newsflash/batch_delete')}">删除选中</button>
                </form>
                {$NewsFlash->render()}
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}

<script type="text/javascript">

    change_sort(5)
    //监听指定开关
    form.on('switch(changeStatus)', function (data) {
        changeStatus(data, 5);
    });
</script>
{/block}
